package org.sky;

import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;

import javax.servlet.FilterRegistration;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;

/**
 * @author weifx
 * @Title: SpringBootStartApplication
 * @ProjectName springboot-platform
 * @Description: TODO
 * @date 2019/2/28 17:37
 * @Version 1.0
 */
// 修改启动类，继承 SpringBootServletInitializer 并重写 configure 方法
public class SpringBootStartApplication extends SpringBootServletInitializer {

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
        // 注意这里一定要指向原先用main方法执行的Application启动类
        return builder.sources(PlatformCoreApplication.class);
    }
    /**
    @Override
    public void onStartup(ServletContext servletContext)
            throws ServletException {
        //FilterRegistration.Dynamic openEntityManagerInViewFilter = servletContext.addFilter("openEntityManagerInViewFilter", OpenEntityManagerInViewFilter.class);
        //openEntityManagerInViewFilter.setInitParameter("entityManagerFactoryBeanName","entityManagerFactory");
        //openEntityManagerInViewFilter.addMappingForUrlPatterns(null, false, "/*");
        super.onStartup(servletContext);
    }**/
}